package com.wobangkj.common.api.crud;

import com.wobangkj.common.model.crud.Circle;
import com.wobangkj.common.service.CircleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/circle")
public class CircleController {
    @Autowired
    private CircleService CircleService;
    @PostMapping(value = "/create")
    public Object create(@RequestBody Circle data) {
        return CircleService.create(data);
    }

    @PutMapping(value = "/update")
    public Object update(@RequestBody Circle circle) {

        return CircleService.update(circle);
    }

    @GetMapping("/findByNameLike")
    public List<Circle> findByNameLike(String circle_name){
        // 一定要加 "%"+参数名+"%"
        return CircleService.findByNameLike(circle_name);
    }
}
